Skip to content

Conversation

@leibowitz
Copy link
Contributor

@leibowitz leibowitz commented Jun 15, 2021

django-smart-selects is currently initialising fields that aren't displayed on screen (including __prefix__ in the id)
https://docs.djangoproject.com/en/3.2/topics/forms/formsets/#empty-form

These are usually created for one/many-to-many relationships, and are cloned when a user clicks on the "add another" within the admin. The __prefix__ is then replaced with an index number (starting at 0)

There is a lot of code spread around to skip fields that include __prefix__:
https://github.com/django/django/blob/ca9872905559026af82000e46cde6f7dedc897b6/django/contrib/admin/static/admin/js/SelectFilter2.js#L11-L14
https://github.com/django/django/blob/ca9872905559026af82000e46cde6f7dedc897b6/django/contrib/admin/static/admin/js/autocomplete.js#L33

@codecov
Copy link

codecov bot commented Jun 15, 2021

Codecov Report

Merging #332 (ed45b07) into master (2cff847) will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #332   +/-   ##
=======================================
  Coverage   80.42%   80.42%           
=======================================
  Files           8        8           
  Lines         470      470           
  Branches       68       68           
=======================================
  Hits          378      378           
  Misses         60       60           
  Partials       32       32           

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 2cff847...ed45b07. Read the comment docs.

@leibowitz leibowitz changed the title Ignore fields with __prefix__ Ignore fields with __prefix__ in id Jun 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant